home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD-ROM Magazine 28 Bonus
/
CDRomMagazine-SoftKey-ArtPassion-FrenchVersion-Win31Mac.bin
/
data
/
shared.dir
/
03021_Script_ACTIVATE-ENABLE-DISABLE BUTTONS
< prev
next >
Wrap
Text File
|
1996-06-21
|
3KB
|
71 lines
-- --------------------------------------------------------
-- Handler enableButton makes the given button enabled
-- by changing its cast to its enabled cast.
on enableButton whichSprite
changeButtonCast (whichSprite, "ENABLED")
end
-- --------------------------------------------------------
-- Handler disableButton makes the given button disabled
-- by changing its cast to its disabled cast.
on disableButton whichSprite
changeButtonCast (whichSprite, "DISABLED")
end
-- --------------------------------------------------------
-- Handler activateButton makes the given button activated
-- by changing its cast to its activated cast.
on activateButton whichSprite
changeButtonCast (whichSprite, "ACTIVATED")
updateStage
repeat while (not the mouseUp)
nothing -- to keep it hilited
end repeat
end
-- --------------------------------------------------------
-- Handler changeButtonCast changes the cast of the button
-- in the given sprite according to the given mode.
on changeButtonCast whichSprite, mode
set buttonType = word 1 of the name of cast the castNum of sprite whichSprite
set newCastName = buttonType && mode
set the castNum of sprite whichSprite = the number of cast newCastName
end
-- --------------------------------------------------------
-- Handler isActivated checks if the button in the given sprite
-- is active (determined if the last word of the name of the
-- button's cast is "ACTIVATED").
on isActivated whichSprite
set buttonName = the name of cast the castNum of sprite whichSprite
set lastWord = the number of words in buttonName
return (word lastWord of buttonName = "ACTIVATED")
end
-- --------------------------------------------------------
-- Handler isEnabled checks if the button in the given sprite
-- is enabled (determined if the last word of the name of the
-- button's cast is "ENABLED").
on isEnabled whichSprite
set buttonName = the name of cast the castNum of sprite whichSprite
set lastWord = the number of words in buttonName
return (word lastWord of buttonName = "ENABLED")
end
-- --------------------------------------------------------
-- Handler isDisabled checks if the button in the given sprite
-- is disabled (determined if the last word of the name of the
-- button's cast is "DISABLED").
on isDisabled whichSprite
set buttonName = the name of cast the castNum of sprite whichSprite
set lastWord = the number of words in buttonName
return (word lastWord of buttonName = "DISABLED")
end